<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<script src="./jquery.js"></script>
	<script>
		$(function() {
			$('#btn_reg').click(function() {
				$.ajax({
					url: '/reg',
					data: {user: $('#user').val(), password: $('#password').val()},
					dataType: 'json',
					type: 'get',
					success(json) {
						if (json.err) {
							alert(json.msg);
						} else {
							alert(json.msg);
						}
					}
				})
			})


			$('#btn_login').click(function() {
				$.ajax({
					url: '/login',
					data: {user: $('#user').val(), password: $('#password').val()},
					dataType: 'json',
					type: 'get',
					success(json) {
						if (json.err) {
							alert(json.msg);
						} else {
							alert(json.msg);
						}
					}
				})
			})
		})
	</script>
</head>
<body>
	用户名：<input type="text" id="user" > <br>
	密码：<input type="password" id="password" > <br>
	<input type="button" value="注册" id="btn_reg">
	<input type="button" value="登录" id="btn_login">
</body>
</html>